#include "FloydAlg.h"
#include "windows.h"

double floydSequential( int n, int* d ) //d must be initialized with adj matrix
{
	LARGE_INTEGER freq;
	LARGE_INTEGER sQP, fQP;
	QueryPerformanceFrequency(&freq);
	QueryPerformanceCounter(&sQP);

	for (int k=0; k<n; k++)
		for (int i=0; i<n; i++)
			for (int j=0; j<n; j++)
				if (d[i*n+k]>=0 && d[k*n+j]>=0)
					if ((d[i*n+j] > (d[i*n+k] + d[k*n+j])) || ( d[i*n+j]<0) )
						d[i*n+j] =  d[i*n+k] + d[k*n+j]; 	

	QueryPerformanceCounter(&fQP);
	return (fQP.QuadPart-sQP.QuadPart)/(double)freq.QuadPart;
}
